/*
 * Filename    : State_Activity.java
 * Projectname : Sound Of Indonesia
 * Date        : Nov 1, 2012 , 12:37:33 PM 
 * 
 * PratamaNurWijaya
 */

package id.pratama.soundofindonesia.state;

import id.pratama.soundofindonesia.apps.Apps_Data;
import id.pratama.soundofindonesia.graphic.Graphic_Data_Path;
import id.pratama.soundofindonesia.graphic.Graphic_Detach;
import id.pratama.soundofindonesia.text.Text_Detach;

import org.andengine.engine.camera.Camera;
import org.andengine.engine.camera.hud.HUD;
import org.andengine.engine.handler.IUpdateHandler;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.andengine.entity.scene.IOnAreaTouchListener;
import org.andengine.entity.scene.IOnSceneTouchListener;
import org.andengine.entity.scene.ITouchArea;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.util.FPSLogger;
import org.andengine.input.touch.TouchEvent;
import org.andengine.input.touch.detector.ClickDetector;
import org.andengine.input.touch.detector.ClickDetector.IClickDetectorListener;
import org.andengine.input.touch.detector.ScrollDetector;
import org.andengine.input.touch.detector.ScrollDetector.IScrollDetectorListener;
import org.andengine.ui.activity.SimpleBaseGameActivity;

import android.view.KeyEvent;

public class State_Activity extends SimpleBaseGameActivity implements Apps_Data, IUpdateHandler, IOnAreaTouchListener,
		IScrollDetectorListener, IOnSceneTouchListener, IClickDetectorListener, Graphic_Data_Path
{
	// State Menu
	protected static final byte				STATE_LOGO				= 0;
	protected static final byte				STATE_MENU_MAIN			= 1;
	protected static final byte				STATE_MENU_DAERAH		= 2;
	protected static final byte				STATE_MENU_ALAT_MUSIK	= 3;
	protected static final byte				STATE_PLAY				= 4;
	protected static final byte				STATE_DESKRIPSI			= 5;
	protected byte							State_Menu_Current		= -1;

	public static SimpleBaseGameActivity	activity;

	protected Camera						m_Camera;
	protected Scene							m_Scene					= new Scene();
	protected HUD							m_Hud					= new HUD();

	protected Graphic_Detach				grafik					= new Graphic_Detach(this, m_Scene, m_Hud);
	protected Text_Detach					teks					= new Text_Detach(this, m_Scene, m_Hud, grafik);

	protected ScrollDetector				m_Scroll				= new ScrollDetector(this);
	protected ClickDetector					m_Click					= new ClickDetector(this);

	@Override
	public EngineOptions onCreateEngineOptions()
	{
		activity = this;
		m_Camera = new Camera(0, 0, RES_WIDTH, RES_HEIGHT);
		m_Camera.setHUD(m_Hud);

		EngineOptions en = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(
				RES_WIDTH, RES_HEIGHT), m_Camera);

		return en;
	}

	@Override
	protected void onCreateResources()
	{

	}

	@Override
	protected Scene onCreateScene()
	{
		mEngine.registerUpdateHandler(new FPSLogger());
		mEngine.registerUpdateHandler(this);

		m_Scene.setOnAreaTouchListener(this);
		m_Scene.setOnSceneTouchListener(this);
		return m_Scene;
	}

	@Override
	public void onUpdate(float pSecondsElapsed)
	{
		// TODO Auto-generated method stub

	}

	@Override
	public void reset()
	{
		// TODO Auto-generated method stub

	}

	@Override
	public void onScrollStarted(ScrollDetector pScollDetector, int pPointerID, float pDistanceX, float pDistanceY)
	{
		// TODO Auto-generated method stub

	}

	@Override
	public void onScroll(ScrollDetector pScollDetector, int pPointerID, float pDistanceX, float pDistanceY)
	{
		// TODO Auto-generated method stub

	}

	@Override
	public void onScrollFinished(ScrollDetector pScollDetector, int pPointerID, float pDistanceX, float pDistanceY)
	{
		// TODO Auto-generated method stub

	}

	@Override
	public boolean onAreaTouched(TouchEvent pSceneTouchEvent, ITouchArea pTouchArea, float pTouchAreaLocalX,
			float pTouchAreaLocalY)
	{

		return false;
	}

	protected void switchState(byte state)
	{

	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event)
	{

		return false;
	}

	@Override
	public boolean onKeyUp(int keyCode, KeyEvent event)
	{

		return false;
	}

	@Override
	public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent)
	{
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void onClick(ClickDetector pClickDetector, int pPointerID, float pSceneX, float pSceneY)
	{
		// TODO Auto-generated method stub

	}

}
